﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<CRM.Database.Model.CustomerName>>" %>
<%@ Import Namespace="CRM.Resourses" %>


<% Html.DevExpress().GridView(settings =>
                                    {
                                        settings.Name = "gdCustomers";
                                        settings.CallbackRouteValues =
                                            new {Controller = "Customers", Action = "CustomersNamesPartional"};
                                        settings.SettingsPager.PageSize = 20;

                                        settings.KeyFieldName = "IdCustomer";

                                        settings.Settings.ShowGroupPanel = true;
                                        settings.Settings.ShowFilterRow = true;

                                        settings.Width = Unit.Percentage(100);

                                        settings.Columns.Add(column =>
                                                                 {
                                                                     column.Caption = Resourses.CustomerName;
                                                                     column.FieldName = "IdCustomer";
                                                                    // column.
                                                                     column.ColumnType =
                                                                         MVCxGridViewColumnType.HyperLink;
                                                                     column.Settings.FilterMode =
                                                                         ColumnFilterMode.DisplayText;
                                                                     column.Settings.AutoFilterCondition =
                                                                         AutoFilterCondition.Contains;
                                                                     HyperLinkProperties properties = column.PropertiesEdit as HyperLinkProperties;
                                                                    String urlFormatString =
                                                                         Url.Action("Details", "Customers",
                                                                                    new RouteValueDictionary(
                                                                                        new {id = "{0}"}));
                                                                         
                                                                     properties.NavigateUrlFormatString = HttpUtility.UrlDecode(urlFormatString);
                                                                     properties.TextField = "Name";
                                                                     
                                                                 });

                                      
                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.CustomerNumber;
                                            column.FieldName = "SequentialNumber";
                                        });


                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.CustomersProfineRegion;
                                            column.FieldName = "ProfineRegionNameLocalized";
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.customerManager;
                                            column.FieldName = "Manager";
                                           
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.Cities;
                                            column.FieldName = "Cities";
                                            column.Settings.AutoFilterCondition =
                                                AutoFilterCondition.Contains;
                                        });

                                    })
       .Bind(Model).GetHtml();
%>


